package com.example.movie_demo

import android.annotation.SuppressLint
import androidx.work.Data
import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.WorkManager
import androidx.work.WorkRequest
import com.example.movie_demo.MainActivity.Companion.USERNANE

object EventUtil {

    @SuppressLint("RestrictedApi")
    fun appendEvent(event:String){
        val uploadWorkRequest: WorkRequest =
            OneTimeWorkRequestBuilder<UploadWorker>()
                .setInputData(
                    Data.Builder()
                    .put("username", USERNANE)
                    .put("event",event)
                    .build())
                .build()
        WorkManager
            .getInstance()
            .enqueue(uploadWorkRequest)
    }

}